#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    int cout = 0;
    for (int i = 0; i < n - 1; i++) {
        for (int j = i + 1; j < n; j++) {
            if (a[i] > a[j]) {
                cout++;
            }
        }
    }

    printf("%d", cout);
    return 0;
}